<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ include file="/common/common.jsp" %>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    
    <title>页头</title>
    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="页头">
	<meta http-equiv="description" content="This is my page">

	<style type="text/css">
	.menu
	{
		background-image:url(${CONTEXT_PATH}/images/common/menu2.gif);
		background-repeat:no-repeat;
		cursor:hand;
		color:white;
	}
	</style>
	
  </head>
  
  <body>
    <center>
    	<s:form name="frm" id="frm" method="post" action="" namespace="">
    		<table style="background-image:url(${CONTEXT_PATH}/images/common/topBg.gif); background-repeat:repeat-x;" width="100%" cellspacing="0" cellpadding="3" height="115">
    			<tr>
    				<td width="30%" height="75">
    					
    				</td>
    				<td width="70%" align="right" valign="middle">
    					
    					<table cellspacing="0" cellpadding="3">
    						<tr height="24px" valign="middle">
    							<td width="50px" align="left">
    								您好：
    							</td>
    							<td width="200px" align="left" style="color:orange; font-weight:bold;">
    								<s:property value="user.username"/>
    							</td>
    							<td width="70px"></td>
    						</tr>
    						<tr height="24px">
    							<td colspan="2" align="left" valign="bottom">
    								<a href="javascript:toUpdatePassword()">修改密码</a>
    								&nbsp;
    								<a href="javascript:logout()">安全退出</a>
    							</td>
    							<td align="left">
    								
    							</td>
    						</tr>
    					</table>
    					
    				</td>
    			</tr>
    			<tr>
    				<td height="27" colspan="2" align="left">
    					<table cellspacing="0" cellpadding="2">
    						<tr align="center" valign="middle">
    							<s:iterator value="menuList" status="s">
	    							<td id="firstMenu<s:property value='id'/>" onmouseover="mouseOver(this)" onmouseout="mouseOut(this, <s:property value='id'/>)" onclick="showMenu(<s:property value='id' />, '<s:property value='menuName' />')" width="90px" height="27" class="menu">
	    								<s:property value="menuName"/>
	    							</td>
    							</s:iterator>
    						</tr>
    					</table>
    				</td>
    			</tr>
    			<tr>
    				<td height="10" colspan="2" align="left">
    			</tr>
    		</table>
    	</s:form>
    </center>
    
    <script type="text/javascript">
    var clickMid = 0;
    
    function logout()
    {
    	window.location.href = '${CONTEXT_PATH}/inner/user/logout.action';
    }
    
    //菜单树
	function showMenu(id, name)
	{
		var beforeMenu = $('#firstMenu' + clickMid);
		if(beforeMenu.length != 0)
		{
			beforeMenu.css({'background-image': 'url(${CONTEXT_PATH}/images/common/menu2.gif)', 'color': '#FFFFFF'});
		}
		clickMid = id;
		var left = parent.leftFrame;
		var main = parent.mainFrame;
		var mid = left.document.getElementById('mid');
		mid.value = id;
		left.document.forms['frm'].submit();
	}
	
	//菜单鼠标事件
	function mouseOver(td)
	{
		$(td).css({'background-image': 'url(${CONTEXT_PATH}/images/common/menu1.gif)', 'color': '#000000'});
	}
	function mouseOut(td, mid)
	{
		if(mid != clickMid)
		{
			$(td).css({'background-image': 'url(${CONTEXT_PATH}/images/common/menu2.gif)', 'color': '#FFFFFF'});
		}
	}
	
	function toUpdatePassword()
	{
		var url = '${CONTEXT_PATH}/inner/user/toUpdatePassword.action';
    	showMd(url, 350, 280);
	}
    </script>
  </body>
</html>
